package com.nut.lmsc.api.admin;

import com.nut.lmsc.api.req.RefundReq;
import com.nut.lmsc.common.Holder;
import com.nut.lmsc.interceptor.AdminJwt;
import com.nut.lmsc.service.PayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/admin/pay")
public class PayController {

    @Autowired
    private PayService payService;

    /**
     * 退款
     */
    @PostMapping("refund")
    public void refund(@RequestBody RefundReq req) {
        AdminJwt adminJwt = Holder.ADMIN_JWT_THREAD_LOCAL.get();
        payService.refund(req, adminJwt);
    }

}